/*
 * Frame.cpp
 *
 *  Created on: May 29, 2010
 *      Author: bubuntux
 */

#include "Frame.h"

Frame::Frame() {

}

Frame::Frame(int new_heigth, int new_width, int new_y, int new_x) {
	height = new_heigth;
	max = new_heigth - TOPRESUME;
	width = new_width;
	win = newwin(height, width, new_y, new_x);
	wborder(win, '|', '|', '-', '-', ' ', ' ', ' ', ' ');
	//box(win,0,0);
	panel = new_panel(win);
	init();
}

void Frame::addLine(string line) {
	//TODO asignar el color segun el mensaje
	resume.push_back(Field(line));
	if (resume.size() >= max) {
		resume.erase(resume.begin());
	}
}

void Frame::init() {
	header.text = "Conecta tu USB";
	resume.clear();
}

void Frame::print() {
	Ui::printCenter(win, 1, header);
	Ui::printCenter(win, 3, scanFile);
	unsigned int i = TOPRESUME;
	for (vector<Field>::iterator it = resume.begin(); it != resume.end(); ++it) {
		Ui::printCenter(win, i, *it);
		i++;
	}
}

Frame::~Frame() {
	// TODO Auto-generated destructor stub
}
